using NodeCanvas.Framework;
using UnityEngine;
using Yoozoo.Gameplay.Liberty.AI;
using Yoozoo.Gameplay.Liberty.AI.Node;
using Yoozoo.Gameplay.Liberty.StreetEvent;

namespace com.yoozoo.gta.Gameplay.Liberty.AI.Node
{
    public class NpcIsGotoCup : AIConditionBaseNode
    {
        public BBParameter<Transform> Target;
        protected override bool OnCheck()
        {
            if (StreetFightEvent.Instance.HoldCupUniqueId != 0 && StreetFightEvent.Instance.HoldCupUniqueId != _entity.id)
            {
                var aiEntity = LibertyAIUtils.AIManager.NpcBirthManager.GetNpc(StreetFightEvent.Instance.HoldCupUniqueId);
                if (aiEntity!=null)
                {
                    Target.value = aiEntity.viewer.viewerRoot.transform;
                    return true;
                }
            }
            return false;
        }
    }
}